home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993…ch: Other People's Memory / ADC Developer CD (1993-03) (''Other People's Memory'')_iso / Dev.CD Mar 93.iso / Development Platforms / Apple II / Essentials / APW Interfaces / CInclude / Control.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-03-04  |  16.4 KB  |  465 lines  |  [TEXT/MPS ]

  1. /********************************************
  2. ; File: Control.h
  3. ;
  4. ;
  5. ; Copyright Apple Computer, Inc.1986-91
  6. ; All Rights Reserved
  7. ;
  8. ********************************************/
  9.  
  10. #ifndef __TYPES__
  11. #include <TYPES.h>
  12. #endif
  13.  
  14. #ifndef __QUICKDRAW__
  15. #include <QUICKDRAW.h>
  16. #endif
  17.  
  18. #ifndef __EVENT__
  19. #include <EVENT.h>
  20. #endif
  21.  
  22. #ifndef __CONTROL__
  23. #define __CONTROL__
  24.  
  25.  
  26. /* Axis Parameters */
  27. #define noConstraint 0x0000  /* No constraint on movement. */
  28. #define hAxisOnly 0x0001  /* Horizontal axis only. */
  29. #define vAxisOnly 0x0002  /* Vertical axis only. */
  30.  
  31. /* CtlFlag */
  32. #define simpRound 0x0000  /* Simple button flag */
  33. #define upFlag 0x0001  /* Scroll bar flag.  */
  34. #define boldButton 0x0001  /* Bold round cornered outlined button. */
  35. #define simpBRound 0x0001  /* Simple button flag */
  36. #define downFlag 0x0002  /* Scroll bar flag. */
  37. #define simpSquare 0x0002  /* Simple button flag */
  38. #define simpDropSquare 0x0003  /* Simple button flag */
  39. #define leftFlag 0x0004  /* Scroll bar flag. */
  40. #define rightFlag 0x0008  /* Scroll bar flag. */
  41. #define dirScroll 0x0010  /* Scroll bar flag. */
  42. #define horScroll 0x0010  /* Scroll bar flag. */
  43. #define family 0x007F  /* Mask for radio button family number */
  44. #define ctlInVis 0x0080  /* invisible mask for any type of control  */
  45. #define fCallWindowMgr 0x0001  /* Control Template flag value */
  46. #define fSubstituteText 0x0002
  47. #define fSubTextType 0x0001
  48. #define inListBox 0x88
  49. #define fBlastText 0x0004 /* static text control */
  50. #define fTextCanDim 0x0008    /* static text control */
  51. #define fNoTrackIcon 0x0008 /* make Icon Button play dead */
  52.  
  53. /* CtlProc Codes */
  54. #define simpleProc 0x00000000L
  55. #define checkProc 0x02000000L
  56. #define radioProc 0x04000000L
  57. #define scrollProc 0x06000000L
  58. #define growProc 0x08000000L
  59.  
  60. /* DefProc Commands */
  61. #define drawCtl 0x0000  /* Draw control command. */
  62. #define calcCRect 0x0001  /* Compute drag RECT command. */
  63. #define testCtl 0x0002  /* Hit test command. */
  64. #define initCtl 0x0003  /* Initialize command. */
  65. #define dispCtl 0x0004  /* Dispose command. */
  66. #define posCtl 0x0005  /* Move indicator command. */
  67. #define thumbCtl 0x0006  /* Compute drag parameters command. */
  68. #define dragCtl 0x0007  /* Drag command. */
  69. #define autoTrack 0x0008  /* Action command. */
  70. #define newValue 0x0009  /* Set new value command. */
  71. #define setParams 0x000A  /* Set new parameters command. */
  72. #define moveCtl 0x000B  /* Move command. */
  73. #define recSize 0x000C  /* Return record size command. */
  74. #define ctlHandleEvent 0x000D  /* Handle a keystroke or menu selection */
  75. #define ctlChangeTarget 0x000E  /* Issued when control's target status has changed */
  76. #define ctlChangeBounds 0x000F  /* Issued when control's boundary rectangle has changed */
  77. #define ctlWindChangeSize 0x0010  /* Window has been grown or zoomed */
  78. #define ctlHandleTab 0x0011  /* Control has been tabbed to */
  79. #define ctlNotifyMultiPart 0x0012  /* A multipart control has been hidden, drawn or shown */
  80. #define ctlWinStateChange 0x0013  /* Window state has changed */
  81.  
  82. /* hiliteState Codes */
  83. #define noHilite 0x0000  /* Param to HiliteControl */
  84. #define inactiveHilite 0x00FF  /* Param to HiliteControl */
  85.  
  86. /* PartCode Numbers */
  87. #define noPart 0x0000
  88. #define simpleButton 0x0002
  89. #define checkBox 0x0003
  90. #define radioButton 0x0004
  91. #define upArrow 0x0005
  92. #define downArrow 0x0006
  93. #define pageUp 0x0007
  94. #define pageDown 0x0008
  95. #define growBox 0x000A
  96. #define thumb 0x0081
  97.  
  98. /* moreFlags Codes */
  99. #define fCtlTarget 0x8000  /* is current target of typing commands */
  100. #define fCtlCanBeTarget 0x4000  /* can be made the target control */
  101. #define fCtlWantEvent 0x2000  /* control can be called view SendEventToCtl */
  102. #define fCtlWantsEvent 0x2000  /* control can be called view SendEventToCtl */
  103. #define fCtlWantEvents 0x2000  /* control can be called view SendEventToCtl */
  104. #define fCtlWantsEvents 0x2000  /* control can be called view SendEventToCtl */
  105. #define fCtlProcRefNotPtr 0x1000  /* set = ID of defproc, clear = pointer to defproc */
  106. #define fCtlTellAboutSize 0x0800  /* set if ctl needs notification when size of owning window changes */
  107. #define fCtlIsMultiPart 0x0400  /* set if ctl needs notification to be hidden */
  108. #define fMenuDefIsText 0x0004
  109. #define fDrawIconInResult 0x0020
  110. #define fDrawPopDownIcon 0x0080
  111. #define colorDescriptor 0x000C  /* indicates type of reference in colorRef */
  112. #define styleDescriptor 0x0003  /* indicates type of reference in styleRef */
  113.  
  114. /* Ctl Verbs */
  115. #define titleIsPtr 0x00
  116. #define titleIsHandle 0x01
  117. #define titleIsResource 0x02
  118. #define colorTableIsPtr 0x00
  119. #define colorTableIsHandle 0x04
  120. #define colorTableIsResource 0x08
  121. #define ctlHideCtl 0x12
  122.  
  123. /* InputVerb Codes */
  124. #define singlePtr 0x0000
  125. #define singleHandle 0x0001
  126. #define singleResource 0x0002
  127. #define ptrToPtr 0x0003
  128. #define ptrToHandle 0x0004
  129. #define ptrToResource 0x0005
  130. #define handleToPtr 0x0006
  131. #define handleToHandle 0x0007
  132. #define handleToResource 0x0008
  133. #define resourceToResource 0x0009
  134.  
  135. /* ProcRefs */
  136. #define simpleButtonControl 0x80000000L
  137. #define checkControl 0x82000000L
  138. #define radioControl 0x84000000L
  139. #define scrollBarControl 0x86000000L
  140. #define growControl 0x88000000L
  141. #define statTextControl 0x81000000L
  142. #define editLineControl 0x83000000L
  143. #define editTextControl 0x85000000L
  144. #define popUpControl 0x87000000L
  145. #define listControl 0x89000000L
  146. #define pictureControl 0x8D000000L
  147. #define iconButtonControl 0x87FF0001L
  148. #define thermometerControl 0x87FF0002L
  149. #define rectangleControl 0x87FF0003L
  150.  
  151. /* Error Codes */
  152. #define wmNotStartedUp 0x1001  /* Window manager was not initialized */
  153. #define cmNotInitialized 0x1002  /* Control manager was not initialized */
  154. #define noCtlInList 0x1003  /* Control not in window list */
  155. #define noCtlError 0x1004  /* no controls in window */
  156. #define noSuperCtlError 0x1005  /* no super controls in window */
  157. #define noCtlTargetError 0x1006  /* no target super control */
  158. #define notSuperCtlError 0x1007  /* action can only be done on super control */
  159. #define canNotBeTargetError 0x1008  /* conrol cannot be made target */
  160. #define noSuchIDError 0x1009  /* specified ID cannot be found */
  161. #define tooFewParmsError 0x100A  /* not enough params specified */
  162. #define noCtlToBeTargetError 0x100B  /* NextCtl call, no ctl could be target */
  163. #define noFrontWindowError 0x100C  /* there is no front window */
  164.  
  165. /* displayMode flags */
  166. #define selectedIcon 0x0001
  167. #define openIcon 0x0002
  168. #define offline 0x0004
  169.  
  170. /* listType values */
  171. #define fListString 0x0001
  172. #define fListSelect 0x0002
  173. #define fListScrollBar 0x0004
  174.  
  175. /* PopUp control flag values */
  176. #define fRightJustifyResult 0x0001
  177. #define fRightJustifyTitle 0x0002
  178. #define fInWindowOnly 0x0004
  179. #define fDontDrawResult 0x0008
  180. #define fDontDrawTitle 0x0010
  181. #define fDontHiliteTitle 0x0020
  182. #define fType2PopUp 0x0040
  183. #ifndef WindowPtr
  184. typedef GrafPortPtr WindowPtr;
  185. #endif
  186.  
  187. struct BarColors {
  188.    Word barOutline; /* color for outlining bar, arrows, and thumb */
  189.    Word barNorArrow; /* color of arrows when not highlighted */
  190.    Word barSelArrow; /* color of arrows when highlighted */
  191.    Word barArrowBack; /* color of arrow box's background */
  192.    Word barNorThumb; /* color of thumb's background when not highlighted */
  193.    Word barSelThumb; /* color of thumb's background when highlighted */
  194.    Word barPageRgn; /* color and pattern page region: high byte - 1= dither, 0 = solid */
  195.    Word barInactive; /* color of scroll bar's interior when inactive */
  196. } ;
  197. typedef struct BarColors BarColors, *BarColorsPtr, **BarColorsHndl;
  198.  
  199. struct BoxColors {
  200.    Word boxReserved; /* reserved */
  201.    Word boxNor; /* color of box when not checked */
  202.    Word boxSel; /* color of box when checked */
  203.    Word boxTitle; /* color of check box's title */
  204. } ;
  205. typedef struct BoxColors BoxColors, *BoxColorsPtr, **BoxColorsHndl;
  206.  
  207. struct BttnColors {
  208.    Word bttnOutline; /* color of outline */
  209.    Word bttnNorBack; /* color of background when not selected */
  210.    Word bttnSelBack; /* color of background when selected */
  211.    Word bttnNorText; /* color of title's text when not selected */
  212.    Word bttnSelText; /* color of title's text when selected */
  213. } ;
  214. typedef struct BttnColors BttnColors, *BttnColorsPtr, **BttnColorsHndl;
  215.  
  216. struct CtlRec {
  217.    struct CtlRec **ctlNext; /* Handle of next control. */
  218.    WindowPtr ctlOwner; /* Pointer to control's window. */
  219.    Rect ctlRect; /* Enclosing rectangle. */
  220.    Byte ctlFlag; /* Bit flags. */
  221.    Byte ctlHilite; /* Highlighted part. */
  222.    Word ctlValue; /* Control's value. */
  223.    LongProcPtr ctlProc; /* Control's definition procedure. */
  224.    LongProcPtr ctlAction; /* Control's action procedure. */
  225.    Longint ctlData; /* Reserved for CtrlProc's use. */
  226.    Longint ctlRefCon; /* Reserved for application's use. */
  227.    Pointer ctlColor; /* Pointer to appropriate color table. */
  228.    Byte ctlReserved[16]; /* Reserved for future expansion */
  229.    LongWord ctlID; /*  */
  230.    Word ctlMoreFlags; /*  */
  231.    Word ctlVersion; /*  */
  232. } ;
  233. typedef struct CtlRec CtlRec, *CtlRecPtr, **CtlRecHndl, ***CtlRecHndlPtr;
  234.  
  235. struct LimitBlk {
  236.    Rect boundRect; /* Drag bounds. */
  237.    Rect slopRect; /* Cursor bounds. */
  238.    Word axisParam; /* Movement constrains. */
  239.    Pointer dragPatt; /* Pointer to 32 byte Pattern for drag outline. */
  240. } ;
  241. typedef struct LimitBlk LimitBlk, *LimitBlkPtr, **LimitBlkHndl;
  242.  
  243. struct RadioColors {
  244.    Word radReserved; /* reserved */
  245.    Word radNor; /* color of radio button when off */
  246.    Word radSel; /* color of radio button when on */
  247.    Word radTitle; /* color of radio button's title text */
  248. } ;
  249. typedef struct RadioColors RadioColors, *RadioColorsPtr, **RadioColorsHndl;
  250.  
  251. struct KeystrokeRec {
  252.    Byte key1; /*   */
  253.    Byte key2; /*   */
  254.    Word keyModifiers; /*   */
  255.    Word keyCareBits; /*   */
  256. } ;
  257. typedef struct KeystrokeRec KeystrokeRec;
  258.  
  259. struct ControlTemplate {
  260.    Word pCount; /*   */
  261.    LongWord ID; /*   */
  262.    Rect rect; /*   */
  263.    LongWord procRef; /*   */
  264.    Word flag; /*   */
  265.    Word moreFlags; /*   */
  266.    LongWord refCon; /*   */
  267. } ;
  268. typedef struct ControlTemplate ControlTemplate;
  269.  
  270. struct SimpleButtonTemplate {
  271.    ControlTemplate ctlTemplate; /*   */
  272.    Ref titleRef; /*   */
  273.    Ref colorTableRef; /*   */
  274.    KeystrokeRec keyEquivalent; /*   */
  275. } ;
  276. typedef struct SimpleButtonTemplate SimpleButtonTemplate;
  277.  
  278. struct CheckBoxTemplate {
  279.    ControlTemplate ctlTemplate; /*   */
  280.    Ref titleRef; /*   */
  281.    Word initalValue; /*   */
  282.    Ref colorTableRef; /*   */
  283.    KeystrokeRec keyEquivalent; /*   */
  284. } ;
  285. typedef struct CheckBoxTemplate CheckBoxTemplate;
  286.  
  287. struct IconButtonTemplate {
  288.    ControlTemplate ctlTemplate; /*   */
  289.    Ref iconRef; /*   */
  290.    Ref titleRef; /*   */
  291.    Ref colorTableRef; /*   */
  292.    Word displayMode; /*   */
  293.    KeystrokeRec keyEquivalent; /*   */
  294. } ;
  295. typedef struct IconButtonTemplate IconButtonTemplate;
  296.  
  297. struct LineEditTemplate {
  298.    ControlTemplate ctlTemplate; /*   */
  299.    Word maxSize; /*   */
  300.    Ref defaultRef; /*   */
  301.    Word passwordChar;
  302. } ;
  303. typedef struct LineEditTemplate LineEditTemplate;
  304.  
  305. struct ListTemplate {
  306.    ControlTemplate ctlTemplate;
  307.    Word listSize;
  308.    Word listView;
  309.    Word listType;
  310.    Word listStart;
  311.    ProcPtr listDraw;
  312.    Word listMemHeight;
  313.    Word listMemSize;
  314.    Ref listRef;
  315.    Ref colorTableRef; /*   */
  316. } ;
  317. typedef struct ListTemplate ListTemplate;
  318.  
  319. struct PictureTemplate {
  320.    ControlTemplate ctlTemplate; /*   */
  321.    Ref pictureRef; /*   */
  322. } ;
  323. typedef struct PictureTemplate PictureTemplate;
  324.  
  325. struct PopupTemplate {
  326.    ControlTemplate ctlTemplate; /*   */
  327.    Word titleWidth; /*   */
  328.    Ref menuRef; /*   */
  329.    Word initialValue; /*   */
  330.    Ref colorTableRef; /*   */
  331. } ;
  332. typedef struct PopupTemplate PopupTemplate;
  333.  
  334. struct RadioButtonTemplate {
  335.    ControlTemplate ctlTemplate; /*   */
  336.    Ref titleRef; /*   */
  337.    Word initalValue; /*   */
  338.    Ref colorTableRef; /*   */
  339.    KeystrokeRec keyEquivalent; /*   */
  340. } ;
  341. typedef struct RadioButtonTemplate RadioButtonTemplate;
  342.  
  343. struct RectangleTemplate {
  344.     ControlTemplate ctlTemplate;
  345.     Word penHeight;
  346.     Word penWidth;
  347.     Mask penMask;
  348.     Pattern penPattern;
  349. } ;
  350. typedef struct RectangleTemplate RectangleTemplate;
  351.  
  352. struct ScrollBarTemplate {
  353.    ControlTemplate ctlTemplate; /*   */
  354.    Word maxSize; /*   */
  355.    Word viewSize; /*   */
  356.    Word initalValue; /*   */
  357.    Ref colorTableRef; /*   */
  358. } ;
  359. typedef struct ScrollBarTemplate ScrollBarTemplate;
  360.  
  361. struct SizeBoxTemplate {
  362.    ControlTemplate ctlTemplate; /*   */
  363.    Ref colorTableRef; /*   */
  364. } ;
  365. typedef struct SizeBoxTemplate SizeBoxTemplate;
  366.  
  367. struct StaticTextTemplate {
  368.    ControlTemplate ctlTemplate; /*   */
  369.    Ref textRef; /*   */
  370.    Word textSize; /*   */
  371.    Word just; /*   */
  372. } ;
  373. typedef struct StaticTextTemplate StaticTextTemplate;
  374.  
  375. struct TextEditTemplate {
  376.    ControlTemplate ctlTemplate;
  377.    LongWord textFlags;
  378.    Rect indentRect;
  379.    CtlRecHndl vertBar;
  380.    Word vertAmount;
  381.    CtlRecHndl horzBar;
  382.    Word horzAmount;
  383.    Ref styleRef;
  384.    Word textDescriptor;
  385.    Ref textRef;
  386.    LongWord textLength;
  387.    LongWord maxChars;
  388.    LongWord maxLines;
  389.    Word maxCharsPerLine;
  390.    Word maxHeight;
  391.    Ref colorRef;
  392.    Word drawMode;
  393.    ProcPtr filterProcPtr;
  394. } ;
  395. typedef struct TextEditTemplate TextEditTemplate;
  396.  
  397. struct ThermometerTemplate {
  398.     ControlTemplate ctlTemplate;
  399.     Word value;
  400.     Word data;
  401.     Ref colorTableRef;
  402. } ;
  403. typedef struct ThermometerTemplate ThermometerTemplate;
  404.  
  405. extern pascal LongWord CallCtlDefProc() inline(0x2C10,dispatcher);
  406. extern pascal Handle CMLoadResource() inline(0x3210,dispatcher);
  407. extern pascal void CMReleaseResource() inline(0x3310,dispatcher);
  408. extern pascal void CtlBootInit() inline(0x0110,dispatcher);
  409. extern pascal void CtlNewRes() inline(0x1210,dispatcher);
  410. extern pascal void CtlReset() inline(0x0510,dispatcher);
  411. extern pascal void CtlShutDown() inline(0x0310,dispatcher);
  412. extern pascal void CtlStartUp() inline(0x0210,dispatcher);
  413. extern pascal Boolean CtlStatus() inline(0x0610,dispatcher);
  414. extern pascal Word CtlVersion() inline(0x0410,dispatcher);
  415. extern pascal void DisposeControl() inline(0x0A10,dispatcher);
  416. extern pascal void DragControl() inline(0x1710,dispatcher);
  417. extern pascal Point DragRect() inline(0x1D10,dispatcher);
  418. extern pascal void DrawControls() inline(0x1010,dispatcher);
  419. extern pascal void DrawOneCtl() inline(0x2510,dispatcher);
  420. extern pascal void EraseControl() inline(0x2410,dispatcher);
  421. extern pascal Word FindControl () inline(0x1310,dispatcher);
  422. extern pascal CtlRecHndl FindTargetCtl() inline(0x2610,dispatcher);
  423. extern pascal void FutzCtls() inline(0x3610,dispatcher);
  424. extern pascal LongProcPtr GetCtlAction() inline(0x2110,dispatcher);
  425. extern pascal Word GetCtlDPage() inline(0x1F10,dispatcher);
  426. extern pascal CtlRecHndl GetCtlHandleFromID() inline(0x3010,dispatcher);
  427. extern pascal LongWord GetCtlID() inline(0x2A10,dispatcher);
  428. extern pascal Word GetCtlMoreFlags() inline(0x2E10,dispatcher);
  429. extern pascal Pointer GetCtlParamPtr() inline(0x3510,dispatcher);
  430. extern pascal LongWord GetCtlParams() inline(0x1C10,dispatcher);
  431. extern pascal LongWord GetCtlRefCon() inline(0x2310,dispatcher);
  432. extern pascal Pointer GetCtlTitle() inline(0x0D10,dispatcher);
  433. extern pascal Word GetCtlValue() inline(0x1A10,dispatcher);
  434. extern pascal LongWord GrowSize() inline(0x1E10,dispatcher);
  435. extern pascal void HideControl() inline(0x0E10,dispatcher);
  436. extern pascal void HiliteControl() inline(0x1110,dispatcher);
  437. extern pascal void InvalCtls() inline(0x3710,dispatcher);
  438. extern pascal void KillControls() inline(0x0B10,dispatcher);
  439. extern pascal CtlRecHndl MakeNextCtlTarget() inline(0x2710,dispatcher);
  440. extern pascal void MakeThisCtlTarget() inline(0x2810,dispatcher);
  441. extern pascal void MoveControl() inline(0x1610,dispatcher);
  442. extern pascal CtlRecHndl NewControl() inline(0x0910,dispatcher);
  443. extern pascal CtlRecHndl NewControl2() inline(0x3110,dispatcher);
  444. extern pascal void NotifyControls() inline(0x2D10,dispatcher);
  445. extern pascal void NotifyCtls() inline(0x2D10,dispatcher);
  446. extern pascal Boolean SendEventToCtl() inline(0x2910,dispatcher);
  447. extern pascal void SetCtlAction() inline(0x2010,dispatcher);
  448. extern pascal FontHndl SetCtlIcons() inline(0x1810,dispatcher);
  449. extern pascal void SetCtlID() inline(0x2B10,dispatcher);
  450. extern pascal void SetCtlMoreFlags() inline(0x2F10,dispatcher);
  451. extern pascal void SetCtlParamPtr() inline(0x3410,dispatcher);
  452. extern pascal void SetCtlParams() inline(0x1B10,dispatcher);
  453. extern pascal void SetCtlRefCon() inline(0x2210,dispatcher);
  454. extern pascal void SetCtlTitle() inline(0x0C10,dispatcher);
  455. extern pascal void SetCtlValue() inline(0x1910,dispatcher);
  456. extern pascal void ShowControl() inline(0x0F10,dispatcher);
  457. extern pascal Word TestControl() inline(0x1410,dispatcher);
  458. extern pascal Word TrackControl() inline(0x1510,dispatcher);
  459.  
  460. extern pascal Word FindRadioButton() inline(0x3910,dispatcher);
  461. extern pascal void SetLETextByID() inline(0x3A10,dispatcher);
  462. extern pascal void GetLETextByID() inline(0x3B10,dispatcher);
  463.  
  464. #endif
  465.